﻿using Api.Catalog.Models;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;

namespace Api.Catalog.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ValuesController : ControllerBase
    {
        [HttpGet]
        public IEnumerable<string> Get()
        {
            return new string[] { "Api.Catalog1", "Api.Catalog2" };
        }


        [HttpGet("{id}")]
        public string Get(int id)
        {
            var headers = HttpContext.Request.Headers;

            var userIdst = HttpContext.Request.Headers.FirstOrDefault(s => s.Key == nameof(TokenPayload.userid));
            var nickenames = HttpContext.Request.Headers.FirstOrDefault(s => s.Key == nameof(TokenPayload.nickename));

            return userIdst + "," + nickenames + ",Api.Catalog";
        }
    }
}
